<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp" %> 



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>    
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui1.5/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui1.5/themes/icon.css">
<script type="text/javascript" src="${path}/js/jquery-1.8.0.min.js"></script>
<script src="${path}/js/jquery/easyui1.5/jquery.easyui.min.js"></script>
<script src="${path}/js/jquery/easyui1.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${path}/js/jquery.select.js"></script>


</head>
<body class="font14">

	<link rel="stylesheet" type="text/css" href="${path}/admin123/css/footer.css">
	<script type="text/javascript">
	$(function(){
		var row = '${paramValues.row[0]}';
		row = decodeURI(row);
		row = JSON.parse(row);
		var tableName = row.tablename;
		var keyRandom = row.keyrandom;
		var tableNameShow = row.tablenameshow;
		var id = row.id;
		//alert(keyRandom)

		//var _id = '${paramValues._id[0]}';
		
		$("#my_tableName").val(tableName);
		$("#my_menu2Name").val(tableNameShow);
		
		
		//保存数据
		$("#my_template2menu").click(function(){
			var menu1Id = $("#my_menu1_id").combobox("getValue");
			var pageType = $("#my_page_type").combobox("getValue");
			var menu2Name = $("#my_menu2Name").val();
			
			if(menu1Id==''){
				alert('请选择一级菜单');
				return;
			}
			
			$.ajax({
				type:"POST",
				url:'${path}/admin123/template/templateAjax_template2menu.action',
				dataType:"json",
				data:{'menu1Id':menu1Id,'_id':id,'pageType':pageType,'menu2Name':menu2Name,'keyRandom':keyRandom},
				success:function(msg){
					alert(msg.responseContent);
					if(msg.responseCode == 1){
						$('#win_common').window('close');
					}
				},
				error:function(er){
					alert(er.responseText.trim());
				}
			});
			
		});


	});
	</script>
	

	<div class="bottom_footer">
		<a id="my_template2menu" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'"
			style="float: right; margin-right: 30px;"
		>生成二级菜单</a>
	</div>
	
	<div style="padding-left: 10px; margin-top: 20px;">
		表名：
		<br/>
		<input type="text" id="my_tableName" readonly="readonly"/>
		<br/>
		<br/>
		选择一级菜单：
		<br/>
		<input id="my_menu1_id" class="easyui-combotree"
	    	data-options="valueField:'id',textField:'text',editable:false,url:'${path}/admin123/right_v2/menuAjax_menuTree4JustMenuParent.action'">
		<br/><br/>
		二级菜单名称（默认是模板名称代替）：
		<br/>
		<input type="text" id="my_menu2Name"/>
		<br/>
		<br/>
		选择菜单页面类型：
		<br/>
    	<select id="my_page_type" class="easyui-combobox" style="width:200px;"
	    	data-options="editable:false">
		    <option value="datagrid-sourcecode">列表页面(源码模式)</option>
		    <option value="datagrid">列表页面</option>
		    <option value="chartPie">图表-饼图</option>
		    <option value="msspline">图表-MS-msspline</option>
		    <option value="scrollcolumn2d">图表-MS-scrollcolumn2d</option>
		    <option value="msarea">图表-MS-msarea</option>
		    <option value="mscolumn3d">图表-MS-mscolumn3d</option>
		    <option value="mscolumn2d">图表-MS-mscolumn2d</option>
		    <option value="msline">图表-MS-msline</option>
		    
		</select>

		<br/>
	</div>
	
</body>
</html>